<template>
	<view>
		<view style="margin-left: 3%;font-size: 16px;" >
			当前分:{{list.integral}}
		</view>
		
		<view style="display: flex;justify-content: space-between;margin: 20px 10px;align-items: center;">
			<view class="">
				上分
			</view>
			<view style="display: flex;align-items: center;">
				<input type="number" value="" style="margin-right: 10px;width: 100px;"   placeholder="请输入分数" v-model="sf"/>分
			</view>
		</view>
		<view style="display: flex;justify-content: space-between;margin: 5px 10px;align-items: center;">
			<view class="">
				下分
			</view>
			<view style="display: flex;align-items: center;">
				<input type="number" value="" style="margin-right: 10px;width: 100px;" v-model="xf"  placeholder="请输入分数"/>分
			</view>
		</view>
		
		<view class="login_btn" @tap="login">
			<button hover-class="btn_hover">确定修改</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				account:'',
				list:[],
				sf:'',
				xf:'',
				q_id:'',
				roomid:'',
			}
		},
		onShow() {
			
		},
		onLoad(options){
			this.account = options.account
			this.q_id = options.q_id
			this.roomid = options.roomid
			let token = uni.getStorageSync("token")
			uni.request({
				url: this.G_base + '/api/lz/quserfOne',
				method: 'POST',
				header: {
					'content-type': 'application/x-www-form-urlencoded',
					'Authori-zation': 'Bearer ' + token
				},
				data:{
					account:this.account,
					id:this.q_id
				},
				success: res => {
					console.log(res)
					this.list = res.data.data
				}
			})
		},
		methods: {
			getPerson(){
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/quserfOne',
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					data:{
						account:this.account,
						id:this.q_id
					},
					success: res => {
						console.log(res)
						this.list = res.data.data
					}
				})
			},
			login(){
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/qxgf',
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					data:{
						uid:this.list.uid,
						sf:this.sf,
						xf:this.xf,
						id:this.roomid
					},
					success: res => {
						console.log(res)
						uni.showToast({
							title:res.data.msg
						})
						this.getPerson();
						this.sf=''
						this.xf=''
					}
				})
			}
		}
	}
</script>

<style scoped>
.login_btn{
			width: 360upx;
			margin: 0 auto;
	}
	.login_btn button{
		flex: 1;
		width: 100%;
		height: 100upx;
		margin: 140upx  0;
		border-radius: 60upx;
		line-height: 100upx;
		color: #fff;
		background: -webkit-linear-gradient(left, #a00000, #e10004, #a00000);
		font-size: 36rpx;
	}
</style>
